package com.gisocn.onemap.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;

/* loaded from: classes2.dex */
public class CustomExpandableListView extends ExpandableListView {
    public CustomExpandableListView(Context context) {
        super(context);
    }

    public CustomExpandableListView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }

    public CustomExpandableListView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    @Override // android.widget.ListView, android.widget.AbsListView, android.view.View
    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(536870911, Integer.MIN_VALUE));
    }

    public static void setListViewHeight(ExpandableListView expandableListView, int i, int i2) {
        ExpandableListAdapter expandableListAdapter = expandableListView.getExpandableListAdapter();
        int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(expandableListView.getWidth(), 1073741824);
        int i3 = 0;
        for (int i4 = 0; i4 < expandableListAdapter.getGroupCount(); i4++) {
            View groupView = expandableListAdapter.getGroupView(i4, false, null, expandableListView);
            groupView.measure(makeMeasureSpec, 0);
            i3 += groupView.getHeight();
            if ((expandableListView.isGroupExpanded(i) && i4 != i) || (!expandableListView.isGroupExpanded(i) && i4 == i)) {
                int i5 = i3;
                for (int i6 = 0; i6 < expandableListAdapter.getChildrenCount(i4); i6++) {
                    View childView = expandableListAdapter.getChildView(i4, i6, false, null, expandableListView);
                    childView.measure(makeMeasureSpec, 0);
                    i5 += childView.getHeight();
                }
                i3 = i5;
            }
        }
        ViewGroup.LayoutParams layoutParams = expandableListView.getLayoutParams();
        int dividerHeight = i3 + (expandableListView.getDividerHeight() * (expandableListAdapter.getGroupCount() - 1));
        if (dividerHeight < 10) {
            dividerHeight = 200;
        }
        layoutParams.height = dividerHeight + (i2 * 120 * 10);
        expandableListView.setLayoutParams(layoutParams);
        expandableListView.requestLayout();
    }
}
